package com.ilioili.waterfall;

import java.util.Observable;
import android.view.View;
import android.view.ViewGroup;

public abstract class Adapter extends Observable{
	/**
	 * justMeasure如果有图片先不要加载，设置好图片ImageView的LayoutParams即可,
	 * 在return v 之前请调�?v.forceLayout()
	 */
	public abstract View getView(View v,ViewGroup vp, int position);
	
	public abstract int getCount();
	
	/**
	 * @param updateMode
	 */
	public void notifyDataSetChanged(int updateMode){
		this.updateMode = updateMode;
		notifyObservers();
	}
	public void notifyDataSetChanged(){
		updateMode = MODE_UPDATE_ALL;
		notifyObservers();
	}
	public void freshItemIfVisible(int position){
		notifyObservers(Integer.valueOf(position));
	}
	public void notifyDataAdded(){
		notifyObservers();
	}
	@Override
	public boolean hasChanged() {
		return true;
	}
	public int getUpdateMode(){
		return updateMode;
	}
	
	final static public int MODE_UPDATE_ALL = 0;
	final static public int MODE_UPDATE_APPEND = 1;
	private int updateMode = MODE_UPDATE_ALL;
}
